#!/bin/bash -e

WDIR="/home/ragnarg/stumpwm/helper/"
TOUCHPAD_STATUS=${1-:"1"}

TOUCHPAD_ID=$(xinput list\
| grep -i touchpad \
| grep -o "id=[0-9]*" \
| cut -f 2 -d'=')

TOUCHPAD_STATUS=$(xinput --list-props $TOUCHPAD_ID \
| grep "Device Enabled " \
| cut -d':' -f 2)

[ $TOUCHPAD_STATUS = "0" ] && NEW_STATUS="1" || NEW_STATUS="0"

$WDIR/toggle-touchpad-manual.sh $NEW_STATUS
